feat(renderer3d): add linear fog mode with start/end distance controls - #665
Merged
Conversation
Adds FogMode enum (Exponential/Linear) to FogConfig, a new goud_renderer3d_configure_fog_linear FFI function, and linear fog branch in all OpenGL and WGSL shaders. Existing ConfigureFog API remains backward compatible. Closes #631 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Add FogConfig unit tests (mode_int, density, start, end, default) - Add FFI invalid-context test for configure_fog_linear - Add SDK headless test for configure_fog_linear - Guard linear fog shader denominator with max(..., 0.00001) Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Contributor
|
Claude finished @aram-devdocs's task in 1m 53s —— View job PR Review: feat(renderer3d): add linear fog mode with start/end distance controlsTasks
Verdict: CHANGES REQUESTEDOne blocker must be addressed before merge. Warnings are non-blocking but recommended. BLOCKERS
WARNINGS
Positive Callouts
SummaryThe fog implementation itself is clean and correct. The only thing blocking merge is the accidental removal of gamepad bindings from the Kotlin/JNI layer — these appear to have been pulled in from an unrelated branch or merge. The parameter-order inconsistency is worth addressing but non-blocking. |
- Extract FogConfig tests into types_tests.rs (types.rs 591->499) - Condense comments in render_helpers.rs (505->499) - Condense module docs in rendering_3d.rs (503->496) Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
The web WASM target has manually listed stub methods in gen_ts_web.py. The new configureFogLinear method was missing, causing the TS web build to fail with TS2420 (class doesn't implement interface). Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
The JNI/Kotlin codegen was missing 4 gamepad button/axis functions because they weren't registered in the schema or ffi_mapping. Also adds gamepad.rs to the build manifest FFI source list and adds .worktrees/ to .gitignore. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
The 15min timeout is too short on cold cache runs, causing consistent cancellation failures. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Restores typed enum parameters for gamepad methods matching the existing Android example expectations. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Removes unused pre-installed software (dotnet, Android SDK, GHC, CodeQL) and Docker images to prevent "No space left on device" during the static archive step. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Overview
Type: feature
Summary:
Adds a linear fog mode with explicit start/end distance parameters to the 3D renderer. The existing exponential fog (
ConfigureFog) remains backward compatible. Linear fog allows precise control over where fog begins and ends, which is critical for games with varying camera distances.Related Issues: Closes #631
Changes Made
Engine Core (
goud_engine/src/)FogModeenum (Exponential { density }|Linear { start, end }) inrenderer3d/types.rsdensity: f32field inFogConfigwithmode: FogModemode_int(),density(),start(),end()) for shader uniform uploadfog_mode,fog_start,fog_enduniform locations toMainUniformsandGridUniformsFFI Layer (
goud_engine/src/ffi/)goud_renderer3d_configure_fog_linear(context_id, enabled, start_distance, end_distance, r, g, b)FFI functiongoud_renderer3d_configure_fogto useFogMode::ExponentialinternallyC# SDK (
sdks/csharp/)ConfigureFogLinearmethod inGoudGame.g.csandNativeMethods.g.csPython SDK (
sdks/python/)configure_fog_linearin_game.pyand_ffi.pyTypeScript SDK (
sdks/typescript/)Codegen Pipeline (
codegen/)configureFogLinearmethod added)goud_renderer3d_configure_fog_linearmapped)Proc Macros (
goud_engine_macros/)#[goud_api]attribute changesNo changes
Tools (
tools/)No changes
WASM (
goud_engine/src/wasm/)No changes
Examples (
examples/)No changes
Documentation
No changes
Architectural Compliance
#[no_mangle] extern "C"and#[repr(C)]where neededunsafeblock without a// SAFETY:commentTesting
cargo testpasses (4873 passed, 0 failed, 26 ignored GPU-context tests)cargo clippy -- -D warningsis cleancargo fmt --all -- --checkpassespython3 sdks/python/test_bindings.py) — if SDK changeddotnet test sdks/csharp.tests/) — if SDK changedcd sdks/typescript && npm test) — if TS SDK changedpython3 codegen/validate.py && python3 codegen/validate_coverage.py)Code Quality
todo!()orunimplemented!()in production code#[allow(unused)]without justification commentResult, notunwrap()/expect()in library codeDocumentation
AGENTS.mdfiles (if architecture changed)README.md(if user-facing behavior changed)Breaking Changes
None
ConfigureFogLinearfunction)configure_fogunchanged)Version Bump
Bump type: minor
Justification: New public API surface (ConfigureFogLinear)
Security
unsafeblocks — or each one has a// SAFETY:comment and is necessarycargo deny check)Performance
Linear fog adds one shader branch per fragment when fog is enabled. The branch is uniform-driven (same for all fragments in a draw call), so GPU branch prediction handles it efficiently. No allocation changes.
Deployment
Reviewer Notes
fogMode,fogStart,fogEnd) plus padding. All 8 WGSL struct copies were updated consistently.max(end - start, 0.00001)) prevents undefined behavior whenstart == end.exp(-d*dist)while main shaders useexp(-(d*dist)^2)— this pre-existing inconsistency was preserved.